package com.jds.apps.hr.project.form;

import java.util.List;

import javax.servlet.http.HttpServletRequest;

import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionMapping;

import com.jds.apps.hr.project.form.ext.AbstractProjectSearchForm;


/**
 * 
 */
public class SearchProjectForm extends AbstractProjectSearchForm {
	
	    
		private List projects;
		public boolean searchMode;
		
	    public ActionErrors validate(ActionMapping mapping, 
	            HttpServletRequest request) {
	
	        ActionErrors errors = new ActionErrors();
	     
            //TODO Implement validation
	        
	        return errors;
	     }
	
	    /**
	     * @return Returns the projects.
	     */
	    public List getProjects() {
	        return projects;
	    }
	    
	    /**
	     * @param projects The projects to set.
	     */
	    public void setProjects(List projects) {
	        this.projects = projects;
	    }

		/**
		 * @return Returns the search results size.
		 */
		public int getListSize() {
			if(projects==null){
				return -1;
			}
			return  projects.size();
		}
		   /**
	     * @return Returns the hasResult.
	     */
	    public String getRecordCount() {
	        return Integer.toString(getListSize());
	    }

	    /**
	     * @return Returns the messageKey.
	     */
	    public String getMessageKey() {
	        
	        if(0 == getListSize()){
	            return "search.zeroresult";
	        } else {
	            return "search.resultcount";
	        }
	    }	
	    /**
	     * @return Returns the searchMode.
	     */
	    public boolean isSearchMode() {
	        return searchMode;
	    }
	    
	    /**
	     * @param searchMode The searchMode to set.
	     */
	    public void setSearchMode(boolean searchMode) {
	        this.searchMode = searchMode;
	    }		
	}

